package com.tiantianfresh.admin.service.Impl;

import com.tiantianfresh.model.dao.PermissionMapper;
import com.tiantianfresh.model.pojo.Permission;
import com.tiantianfresh.admin.service.PermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author FANGAO
 * @date 2021/11/15 - 下午 14:05
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    @Resource
    private PermissionMapper permissionMapper;

    @Override
    public Permission queryRoot() {
        return permissionMapper.queryRoot();
    }

    @Override
    public List<Permission> queryChidPermissions(Integer id) {
        return permissionMapper.queryChidPermissions(id);
    }

    @Override
    public List<Permission> queryAll() {
        return permissionMapper.queryAll();
    }

    @Override
    public boolean insert(Permission permission) {
        if (permissionMapper.insert(permission)>0) return true;
        return false;
    }

    @Override
    public Permission queryById(Integer id) {
        return permissionMapper.queryById(id);
    }

    @Override
    public boolean update(Permission permission) {
        if (permissionMapper.update(permission)>0) return true;
        return false;
    }

    @Override
    public boolean detele(Integer id) {
        if (permissionMapper.detele(id)>0) return true;
        return false;
    }

    @Override
    public List<Integer> queryRolePermissions(Integer id) {
       return permissionMapper.queryRolePermissions(id);
    }

    @Override
    public List<Permission> queryUserPermission(Integer id) {
        return permissionMapper.queryUserPermission(id);
    }
}
